﻿#ifndef WIDGET_H
#define WIDGET_H

#include "udpplay.h"
#include "udprecord.h"

#include <QComboBox>
#include <QLineEdit>
#include <QPushButton>
#include <QWidget>

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

public slots:
    void updateRole(int index);
    void updateIp(void);
    void updatePort(void);
    void initialUI(void);
    void startBtnClicked(void);
    void stopBtnClicked(void);

private:
    UDPRecord* udpRecord = nullptr;
    UDPPlay* udpPlay = nullptr;
    QString hostIp = QString("192.168.31.114");
    quint16 hostPort = 1003;
    quint16 listenPort = 1002;

    bool sendFlag = true;
    QLineEdit* ipLineEdit;
    QLineEdit* portHostLineEdit;
    QLineEdit* portListenLineEdit;

    QPushButton* startBtn;
    QPushButton* stopBtn;
    QPushButton* closeBtn;
    QComboBox* roleBox;
};
#endif // WIDGET_H
